/**
 * creation: 27-apr-2007
 */
package org.jfonia.pitch;

/**
 * @author Wijnand
 *
 */
public class StandardPitchNotationStyle implements PitchNotationStyle
{
	final static String[] rankNames = {"C", "D", "E", "F", "G", "A", "B"};
	
	public String getReducedName(MusicalInterval pitchClass)
	{
		StringBuilder sb = new StringBuilder();
		sb.append(rankNames[pitchClass.getRankClass()]);
		int m = pitchClass.getAccidental();
		if (m > 0)
			for (int i=0; i<m; i++)
				sb.append('#');
		else 
			for (int i=0; i<-m; i++)
				sb.append('b');
			
		return sb.toString();
	}

	public String getName(MusicalInterval pitch)
	{
		return getReducedName(pitch) + pitch.getRegister();	
	}

	public String getUnalteredReducedName(MusicalInterval pitchClass)
	{
		return rankNames[pitchClass.getRankClass()];
	}

	public String getUnalteredReducedName(int pitchClassRank)
	{
		assert(pitchClassRank>=0 && pitchClassRank<12);
		return rankNames[pitchClassRank];
	}

}
